package com.tamplus.cs.util;


public class StringUtils {
	
	public static String padRight(String s, String with, int n) {
	     return String.format("%-"+n+"s", s).replace(" ", with);
	}

	public static String padLeft(String s, String with, int n) {
	    return String.format("%"+n+"s", s).replace(" ", with);
	}
	
	public static boolean isEmpty(String data){
		if(data == null || "".equals(data) || "null".equalsIgnoreCase(data)) return true;
		return false;
	}

	public static String toString(String data){
		if(isEmpty(data)) data = "";
		
		return data;
	}
	
	public static Double parseDouble(String data){
		if(isEmpty(data)) return 0d;
		
		data = data.replaceAll(",", "");
		
		return Double.parseDouble(data);
	}
	public static Integer parseInt(String data){
		if(isEmpty(data)) return 0;
		
		data = data.replaceAll(",", "");
		
		return Integer.parseInt(data);
	}

}

